#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>

#include "oled.h"
#include "font.h"
#include "myoled.h"

#define filename "/dev/i2c-3"
static struct display_info disp;
int oled_display(void *array)
{
    unsigned char *buffer = (unsigned char *)array;
    oled_putstrto(&disp, 0, 9 + 1, "The type of thing is :");
    disp.font = font1;

    switch (buffer[2])
    {
    case 0x61:
        oled_putstrto(&disp, 0, 20, "dry rubbish");
        break;

    case 0x62:
        oled_putstrto(&disp, 0, 20, "wet rubbish");
        break;

    case 0x63:
        oled_putstrto(&disp, 0, 20, "recyclable rubbish");
        break;

    case 0x64:
        oled_putstrto(&disp, 0, 20, "hazardous rubbish");
        break;

    case 0x65:
        oled_putstrto(&disp, 0, 20, "other rubbish");
    }
    disp.font = font2;
    oled_send_buffer(&disp);
    return 0;
}

int myoled_init(void)
{
    int e;
    disp.address = OLED_I2C_ADDR;
    disp.font = font2;
    e = oled_open(&disp, filename);
    e = oled_init(&disp);
    return e;
}